﻿/*
 * Ext Gantt 1.2
 * Copyright(c) 2009-2011 Mats Bryntse Consulting
 * mats@ext-scheduler.com
 * http://www.ext-scheduler.com/license.html
 *
 */

Ext.ns('Sch.gantt');

Sch.gantt.TaskTemplate = function(cfg) {
    return new Ext.Template(
        '<div class="sch-event-wrap sch-gantt-task {ctcls} x-unselectable" style="left:{leftOffset}px;">' +
            // Left label 
            '<div class="sch-gantt-labelct-left"><label class="sch-gantt-label sch-gantt-label-left">{leftLabel}</label></div>'+
                    
            // Task bar
            '<div id="{id}" class="sch-gantt-item sch-gantt-task-bar {internalcls} {cls}" unselectable="on" style="width:{width}px;{style}">'+
                // Left terminal
                (cfg.enableDependencyDragDrop ? '<div unselectable="on" class="sch-gantt-terminal sch-gantt-terminal-start"></div>' : '') +
                ((cfg.resizeHandles === 'both' || cfg.resizeHandles === 'left') ? '<div class="x-resizable-handle x-resizable-handle-west sch-gantt-task-handle"></div>' : '') +
                
                '<div class="sch-gantt-progress-bar" style="width:{percentDone}%" unselectable="on">&#160;</div>' +

                ((cfg.resizeHandles === 'both' || cfg.enableResizeHandles === 'right') ? '<div class="x-resizable-handle x-resizable-handle-east"></div>' : '') +
                // Right terminal
                (cfg.enableDependencyDragDrop ? '<div unselectable="on" class="sch-gantt-terminal sch-gantt-terminal-end"></div>' : '') +
                (cfg.enableProgressBarResize ? '<div style="left:{percentDone}%" class="sch-gantt-progressbar-handle"></div>': '') +
            '</div>' +
                   
            // Right label 
            '<div class="sch-gantt-labelct-right" style="left:{width}px"><label class="sch-gantt-label sch-gantt-label-right">{rightLabel}</label></div>'+
        '</div>' +
        // Baseline Task bar
        (cfg.showBaseline ? '<div id="{id}-base" class="sch-gantt-task-bar-baseline {basecls}" style="left:{baseLeftOffset}px;width:{baseWidth}px"></div>' : ''),
    {
        compiled: true,      
        disableFormats: true 
    });
};